home *** CD-ROM | disk | FTP | other *** search
-
- PROGRAM
-
- MAP
- Chk4Port(BYTE),BYTE
- END
-
-
- CODE
-
- loop i# = 1 to 4
- If Chk4Port(i#)
- show(i#,1,'Com Port '&i#&' Present')
- else
- show(i#,1,'Com Port '&i#&' Not Present')
- end
- end
- ask()
-
- return
-
-
-
- !***************************************************************
- ! Check for a communication port
- !
- ! by John T. Giles
- !***************************************************************
-
- Chk4Port FUNCTION(ComPort)
-
- ! ***********************************************************************
- !
- ! The 8250 UART has 10 registers accessible through 7 port addresses.
- ! Here are their address relative to the communcation base address. NOTE:
- ! the baud rate register, (DLL) and (DLH) are active only when
- ! the Divisor-Latch Access-Bit (DLAB) is on. The (DLAB) is bit 7 of
- ! the (LCR)
- !
- ! TXT - Output data to the serial port
- ! RXR - Input data from the serial port
- ! LCR - Initialize the serial port
- ! IER - Controls interrupt generation
- ! IIR - Indentifies interrupts
- ! MCR - Send control signals to the modem
- ! LSR - Monitor the status of the serial port
- ! MSR - Receive status of the modem
- ! DLL - Low byte of baud rate divisor
- ! DHH - High byte of baud rate divisor
-
- TXR Equate(0) ! Transmit register (WRITE)
- RXR Equate(0) ! Receive register (READ)
- IER Equate(1) ! Interrupt Enable
- IIR Equate(2) ! Interrupt ID
- LCR Equate(3) ! Line Control
- MCR Equate(4) ! Modem Control
- LSR Equate(5) ! Line Status
- MSR Equate(6) ! Modem Status
- DLL Equate(0) ! Divisor Latch Low
- DLH Equate(1) ! Divisor Latch High
-
- Com_Base short,dim(4)
-
- New_iir byte
- Old_iir byte
-
- CODE
-
- Com_Base[1] = 03F8h
- Com_Base[2] = 02F8h
- Com_Base[3] = 03E8h
- Com_Base[4] = 02E8h
-
- in(Com_Base[ComPort]+IIR,old_iir)
- out(Com_Base[ComPort]+IIR,0C1h)
-
- in(Com_Base[ComPort]+IIR,new_iir)
- out(Com_Base[ComPort]+IIR,old_iir)
-
- ! no com port
- if (band(new_iir,38h))
- return(0)
- end
-
- RETURN(1)
-
-
-
-
-
-
-
-
-
-